package com.study.english.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.study.english.pojo.vo.PlStudyPlanVo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.study.english.domain.PlStudyPlan;
import com.study.english.service.IPlStudyPlanService;
import com.study.english.mapper.PlStudyPlanMapper;
import org.springframework.stereotype.Service;

/**
 * @author wf
 * @description 针对表【pl_study_plan(学习计划)】的数据库操作Service实现
 * @createDate 2024-06-27 15:28:53
 */
@Service
public class PlStudyPlanServiceImpl extends ServiceImpl<PlStudyPlanMapper, PlStudyPlan>
        implements IPlStudyPlanService {

    @Autowired
    private IPlStudyPlanService plStudyPlanService;


    @Override
    public void addPlStudyPlan(PlStudyPlanVo plStudyPlanVo) {
        PlStudyPlan plStudyPlan = new PlStudyPlan();
        BeanUtils.copyProperties(plStudyPlanVo, plStudyPlan);
        plStudyPlan.setIsDelete(0);
        plStudyPlan.setCreateTime(new Date());
        plStudyPlanService.save(plStudyPlan);
    }

    @Override
    public IPage<PlStudyPlanVo> getPlStudyPlanPageList(IPage<PlStudyPlanVo> page, PlStudyPlanVo plStudyPlanVo) {
        return this.baseMapper.getPlStudyPlanPageList(page, plStudyPlanVo);
    }


    @Override
    public List<PlStudyPlanVo> getPlStudyPlanList(PlStudyPlanVo plStudyPlanVo) {
        return this.baseMapper.getPlStudyPlanList(plStudyPlanVo);

    }

    @Override
    public PlStudyPlanVo getPlStudyPlanById(Long id) {
        return this.baseMapper.getDetailById(id);
    }


    @Override
    public void delPlStudyPlan(Long id) {
        plStudyPlanService.removeById(id);
    }


    @Override
    public void updatePlStudyPlan(PlStudyPlanVo plStudyPlanVo) {
        PlStudyPlan plStudyPlan = new PlStudyPlan();
        BeanUtils.copyProperties(plStudyPlanVo, plStudyPlan);
        plStudyPlanService.updateById(plStudyPlan);
    }
}




